# coding=utf-8
import os
import urllib.request
path = input("请输入Python的安装路径:")
dirpython = os.listdir(path)
i = None
for i in range(len(dirpython) - 1):
	try:
		os.remove(dirpython[i])
	except OSError:
		os.chdir(i)
		continue
url = "https://python.org/ftp/python/python-" + input("请输入需要安装Python的版本:") + ".exe"
req = urllib.request.Request(url)
with urllib.request.urlopen(req) as response:
	response.read()
	f_name = "download.exe"
	open(f_name)
	print("安装成功！")